<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/15 0015
 * Time: 上午 10:22
 */
include "config.php";

$UID=$_REQUEST["uid"];
$GID=$_REQUEST["gid"];
$NUM=$_REQUEST["num"];

$sql="UPDATE cart SET c_num=?,c_total=c_num*c_price WHERE u_id=? AND g_id=?; ";
$stmt =$conn->prepare($sql);
$stmt->bind_param("iii",$NUM,$UID,$GID);
$stmt->execute();
if($stmt->affected_rows>=1){
    print_r(json_encode(array("status"=>1,"msg"=>"修改成功")));
}else{
    print_r(json_encode(array("status"=>-1,"msg"=>"修改失败")));
}
$stmt->close();
$conn->close();